﻿using System;
using System.Web;
using System.Data;
using System.Linq;
using System.Web.Services;
using System.Collections.Generic;

namespace WS
{
    using BLL;
    using DAL;
    using DAL.Entities;

    /// <summary>
    /// Summary description for Catalog
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Catalog : System.Web.Services.WebService
    {

        #region Danh muc
        DanhmucBLL _bllDanhmuc = new DanhmucBLL();

        [WebMethod]
        public int Danhmuc_Count()
        {
            throw new NotImplementedException();
        }

        [WebMethod]
        public DataTable Danhmuc_Select()
        {
            return _bllDanhmuc.Select();
        }

        [WebMethod]
        public object Danhmuc_Insert(Danhmuc obj)
        {
            return _bllDanhmuc.Insert(obj);
        }

        [WebMethod]
        public object Danhmuc_Update(Danhmuc obj)
        {
            return _bllDanhmuc.Update(obj);
        }

        [WebMethod]
        public object Danhmuc_Delete(Guid id)
        {
            return _bllDanhmuc.Delete(id);
        }

        [WebMethod]
        public DataTable Danhmuc_Select_Loai(string loai)
        {
            return _bllDanhmuc.Select_Loai(loai);
        }

        [WebMethod]
        public DataTable Danhmuc_Select_Parent(Guid id)
        {
            return _bllDanhmuc.Select_Parent(id);
        }
        #endregion

        #region Người dùng
        NguoidungBLL _bllNguoidung = new NguoidungBLL();

        [WebMethod]
        public int Nguoidung_Count()
        {
            return _bllNguoidung.Count();
        }

        [WebMethod]
        public object Nguoidung_Select_By_Taikhoan(string code)
        {
            return _bllNguoidung.Select(code);
        }

        [WebMethod]
        public DataTable Nguoidung_Select()
        {
            return _bllNguoidung.Select();
        }

        [WebMethod]
        public object Nguoidung_Insert(object obj)
        {
            return _bllNguoidung.Insert(obj);
        }

        [WebMethod]
        public object Nguoidung_Update(object obj)
        {
            return _bllNguoidung.Update(obj);
        }

        [WebMethod]
        public object Nguoidung_Delete(Guid id)
        {
            return _bllNguoidung.Delete(id);
        }

        [WebMethod]
        protected object Nguoidung_Update_Matkhau(Nguoidung o)
        {
            return _bllNguoidung.Update(o);
        }
        #endregion
    }
}